package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"queue/facade/frameLog"
	"queue/library/common"
	"strings"
)

func main() {

	logId := common.CreateLogId()
	frameLog.Info(logId)
	//fmt.Println(logId)
	url := "http://127.0.0.1:80/saveMessage"

	//res,err:=http.Post(url,"application/x-www-form-urlencoded",strings.NewReader("name=laowan&age=31"))
	req, _ := http.NewRequest("POST", url, strings.NewReader("name=laowan&age=31"))
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req.Header.Set("Log-Id", logId)

	client := http.Client{}
	res, err := client.Do(req)
	defer res.Body.Close()                 // res.Body 是IO资源，所以读取后需要关闭
	bytes, err := ioutil.ReadAll(res.Body) //读取响应的全部内容

	fmt.Println(string(bytes), err)
}
